package com.wanxi.util;

public class CountString {
    public static void main(String[] args) {
        String str = "fFS4AD3a2";
        int upperCount = 0;
        int lowerCount = 0;
        int numCount = 0;
        for (int i = 0; i < str.length(); i++) {
//            要找到对应字符的ascii玛
            if (str.charAt(i) >= 48 && str.charAt(i) <= 57) {
                numCount++;
            }
            if (str.charAt(i) >= 65 && str.charAt(i) <= 90) {
                upperCount++;
            }
            if (str.charAt(i) >= 97 && str.charAt(i) <= 122) {
                lowerCount++;
            }
        }
        System.out.println("数字次数" + numCount);
        System.out.println("大写次数" + upperCount);
        System.out.println("小写次数" + lowerCount);
    }
}
